package yunhe.servlet;

import yunhe.util.NewsUtil;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.IOException;

@SuppressWarnings("serial")
public class UserExitLogin extends HttpServlet {

	public void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		HttpSession session=request.getSession();
		session.setAttribute("userLoginState", null);
		Cookie[] cookies={new Cookie("nuName","0"),new Cookie("nuPass","0")};
		NewsUtil.addCookies(response, cookies, 0); //设置最大时间寿命为0，清除cookies
		response.sendRedirect(request.getContextPath()+"/GetNews");
	}

	public void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
